/* GUI CONVERTED from rcsois4a.p (converter v1.75) Tue Apr 10 12:05:36 2001 */
/* rcsois4a.p - Release Management Customer Schedules                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.4.1.5 $                                                       */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 8.6    LAST MODIFIED: 09/20/96     BY: TSI *K005*                */
/* REVISION: 8.6    LAST MODIFIED: 12/05/96     BY: *K02F* Chris Theisen      */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98     BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.0    LAST MODIFIED: 03/29/99     BY: *J3BM* Reetu Kapoor       */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00     BY: *N0KP* Mark Brown         */
/* $Revision: 1.4.1.5 $   BY: Jean Miller     DATE: 03/22/01  ECO: *P008*     */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdeclre.i}

/*INPUT PARAMETERS*/
define input parameter abs_recid as recid no-undo.

/*OUTPUT PARAMETERS*/
define output parameter errors as logical no-undo.

/*LOCAL VARIABLES*/
define variable msgtext as character no-undo.
define variable errlevel as integer no-undo.
define variable tot_absr_qty as decimal no-undo.

/*SHARED WORKFILES*/

{rcwabsdf.i new}

for first abs_mstr
fields (abs_shipfrom abs_shipto)
where recid(abs_mstr) = abs_recid no-lock:
end. /* FOR FIRST ABS_MSTR */

{gprun.i ""gpcfmsg.p""
   "(input 1529,
     input 0,
     input program-name(1),
     input abs_shipfrom,
     input abs_shipto,
     input '',
     input false,
     output errlevel)"}
/*GUI*/ if global-beam-me-up then undo, leave.


if errlevel > 0 then do:

   {gprun.i ""rcsoisa.p"" "(input abs_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


   for each work_abs_mstr
      where abs_id begins "I"
   no-lock,
      each so_mstr
      fields (so_nbr so_sched)
      where so_nbr = abs_order
      and   so_sched
   no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


      tot_absr_qty = 0.

      for each absr_det
      fields (absr_id absr_qty absr_shipfrom)
      where absr_shipfrom  = abs_shipfrom
        and absr_id        = abs_id
      no-lock:
         tot_absr_qty = tot_absr_qty + absr_qty.
      end. /* for each absr_det */

      if tot_absr_qty < abs_qty then do:
         assign
            errors  = true
            msgtext = abs_order + "/" + abs_line + "/" + abs_item + "/" +
                      abs_lot + "/" + abs_ref.

         {pxmsg.i &MSGNUM=1529 &ERRORLEVEL=errlevel &MSGARG1=msgtext}

         errors = true.

      end. /* if tot_absr_qty < abs_qty */

   end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* for each work_abs_mstr */

end. /* if errlevel > 0 */

errors = if errors and errlevel < 3 then
            false
         else
            errors.
